子元素居于父元素底部

  |  
 阅读次数

只要父元素的posiiton设置为relative,子元素的位置就是相对于父元素的,这样设置子元素的bottom0,即可将子元素置于父元素底部。

1
2
3
4
5
6
7
8
9
10
11
12
13
.parent{  
position: relative;
width:200px;
height: 100px;
background: dodgerblue;
}
.content{
position: absolute;
width: 200px;
height: 30px;
background: orange;
bottom: 0;
}